package com.cancan.resultreturn.result1.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 过滤器类
 * @author oushihua
 * @since 2019/9/24
 */
@Configuration
public class FilterConfig {

	/**
	 * 拦截器注册
	 * @return
	 */
	@Bean
	public FilterRegistrationBean httpLoggingFilterRegistration() {
		FilterRegistrationBean registration = new FilterRegistrationBean();
		registration.setFilter(new HttpLoggingFilter());
		// 拦截路径
		registration.addUrlPatterns("/*");
		// 拦截器名称
		registration.setName("httpLoggingFilter");
		// 顺序
		registration.setOrder(1);
		return registration;
	}

}